package com.budwk.app.sqfwV2.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author zhangp
 * @description TODO
 * @className CenturyCitySafeCheckGasEnum
 * @Date 17:24 2024/4/3
 */
@Getter
public enum CenturyCitySafeCheckGasUseEnum {

    RQSYQK_YHSYQ("1", "瓶装液化石油气",true),
    RQSYQK_CZRQSYEJM("2", "瓶装城镇燃气用二甲醚",true),
    wu("3", "无",false),
    Pipeline_natural_gas("4", "管道天燃气",false),
    New_type_of_fuel("5", "新型燃料",false),
    Electricity_usage("6", "用电",false),;


    private final String code;
    private final String value;
    private final boolean flag;//是否进入燃气安全监督检查表（true-计入，false-不计入）

    CenturyCitySafeCheckGasUseEnum(String code, String value,boolean flag) {
        this.code = code;
        this.value = value;
        this.flag=flag;
    }

    public static CenturyCitySafeCheckGasUseEnum getEnum(String code) {
        if(StringUtils.isNotBlank(code)){
            for (CenturyCitySafeCheckGasUseEnum o : CenturyCitySafeCheckGasUseEnum.values()) {
                if (code.contains(o.getCode())) {
                    if(o.isFlag()){
                        return o;
                    }
                }
            }
        }
        return null;
    }

    public static CenturyCitySafeCheckGasUseEnum getGasUseStatisticsEnum(String code) {
        if(StringUtils.isNotBlank(code)){
            for (CenturyCitySafeCheckGasUseEnum o : CenturyCitySafeCheckGasUseEnum.values()) {
                if (code.contains(o.getCode())) {
                    return o;
                }
            }
        }
        return null;
    }
}
